//
//  HttpPlatformConnect.h
//  XTCloud
//
//  Created by QA on 2018/1/10.
//  Copyright © 2018年 ShangHai HaoLei Software Technology Co., Ltd. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"
#import "HttpOutputResult.h"
#import "HttpInputRequest.h"

typedef NS_ENUM (NSUInteger, NativeHttpMethod) {
    Native_HttpMethod_GET,
    Native_HttpMethod_POST
};

//接口类型
typedef enum {
    InterfaceTypeCIM = 0,        //CIM库
    InterfaceTypeDataCenter = 1, //Data_Center库
    InterfaceTypeGIM = 2,        //GIM库
    InterfaceTypeLocal = 3,      //本地库
} InterfaceTypeHttp;

//接口类型
typedef enum {
    JavaConnectType = 0,        //JAVA连接方式
    WebServerConnectType = 1 //WebServer连接方式
} ConnectType;

//用于回调请求成功或者失败的信息
typedef void (^ NativeSuccessHandle)(HttpOutputResult* _Nullable responseObject);
typedef void (^ NativeFailureHandle)(NSError *_Nonnull error);

///// 所有简单指针对象都被假定为nonnull，因此我们只需要去指定那些nullable的指针即可。
NS_ASSUME_NONNULL_BEGIN
@interface HttpNativeConnect : NSObject

//实例化
+ (instancetype)shareInstance;

//平台接口（用于适配老接口参数）（已过时）
- (NSURLSessionDataTask *)requestWithParamsString:(NSString*)params
                                          success:(NativeSuccessHandle)successBlock
                                          failure:(NativeFailureHandle)failureBlock;

//平台接口（用于适配新接口参数）
- (NSURLSessionDataTask *)requestWithParams:(HttpInputRequest*)httpInputParams
                                    success:(NativeSuccessHandle)successBlock
                                    failure:(NativeFailureHandle)failureBlock;

/**
 *取消所有执行请求
 */
- (void)cancelAllOperations;

@end

NS_ASSUME_NONNULL_END
